<?php defined('SYSPATH') or die('No direct script access.');

 class Controller_Wish extends Controller{
      //
    public function action_add(){

      $t=$this->request->post('t');

      $id=$this->request->post('id');

      $user=Session::instance()->get('user');

      $result=array();

      if(!empty($user)){

        $userid=$user["userid"];

        $model=new Model_Wish();

        $result=$model->add($userid,$id);

      }
      else{

        $result['code']='0x00001';

      }

      exit(json_encode($result));
    }

    public function action_remove(){

      $id=$this->request->post("id");

      if(empty($id)){

          $result['code']='0x0000x';

      }

      $user=Session::instance()->get('user');

      $result=array();

      if(!empty($user)){

        $userid=$user["userid"];

        $model=new Model_Wish();

        $result=$model->remove($userid,$id);

      }
      else{

        $result['code']='0x00001';

      }

      exit(json_encode($result));
    }

 } 
